<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>活动中心页面</title>
    <link rel="stylesheet" href="../../css/reset.css">
    <style>
        body {
            width: 100%;
            height: auto;
            background-color: #ffffff;
            font-size: 0.26rem;
            -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            font-family: Helvetica;
            color: #333333;
        }

        .centerImgDetail {
            width: 100%;
            height: auto;
            padding: 0 0.22rem;
            box-sizing: border-box;
            padding-top: 0.3rem;
        }

        .imgLi {
            width: 100%;
            display: flex;
            display: -webkit-flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
        }

        .imgLi li {
            width: 100%;
            height: auto;
            position: relative;
        }

        .imgLi li .activiImg {
            width: 100%;
            height: 1.42rem;
            border-radius: 0.1rem;
            margin-bottom: 0.3rem;
        }

        .imgLi li .stuasImg {
            width: auto;
            height: 0.42rem;
            position: absolute;
            right: 0;
            top: 0;
            z-index: 100;
        }
    </style>
</head>

<body>
    <div class="centerImgDetail">
        <ul class="imgLi">
            <!-- <li>
                <img src="../../image/bga.jpg" class="activiImg">
                <img src="../../image/hotasdx.png" class="stuasImg">
            </li>
            <li>
                <img src="../../image/bga.jpg" class="activiImg">
            </li>
            <li>
                <img src="../../image/bga.jpg" class="activiImg">
            </li>
            <li>
                <img src="../../image/bga.jpg" class="activiImg">
            </li>
            <li>
                <img src="../../image/bga.jpg" class="activiImg">
            </li>
            <li>
                <img src="../../image/bga.jpg" class="activiImg">
            </li> -->
        </ul>
    </div>
</body>
<script src="../../script/autosize.js"></script>
<script src="../../script/jquery_three_two_one.js"></script>
<script src="../../script/fastclick.js"></script>
<script src="../../script/dotmin.js"></script>
<script src="../../script/app.js"></script>
<script>
    apiready = function () {
        var app = new APP();
        var param = {
            debug: true,
            crashlog: true,
            period: 0,
            channel: app.ST,
            appKey: "c2ba5a5484d5b8f3a587bf66"
        };
        var ajAnalytics = api.require('ajAnalytics');
        ajAnalytics.init(param, function (ret, err) {
            app.log(JSON.stringify(ret) + JSON.stringify(err));
        })
        var curpage = 1;//当前页
        var totalPage = 1;//总页数
        function getActivityImg(page, isdown) {
            app.ajaxPro({
                url: "site/get-active",
                values: {
                    page: page,
                    pageSize: 20
                },
                openFlower: true
            }, function (ret) {
                if (ret.code == 200) {
                    totalPage = ret.data.totalPage;
                    var temp = doT.template($("#bannerImg").text());
                    if (isdown) {
                        $(".imgLi").html(temp(ret.data.lists));
                    } else {
                        $(".imgLi").append(temp(ret.data.lists));
                    }
                } else {
                    app.toast(ret.message);
                }
            })
        }
        getActivityImg(curpage, true);
        $(".imgLi").on("click", "li", function (params) {

            if (app.ST == "ios") {
                ajAnalytics.onEvent({
                    eventType: "calculate",
                    eventId: 'activityCenter',
                    attrs: { "activityCenter": "activityCenter" },
                    value: 1
                }, function (ret, err) {
                    console.log(JSON.stringify(ret));
                });
            } else {
                ajAnalytics.onEvent({
                    eventType: "calculate",
                    eventId: 'activityCenteranzhuo',
                    attrs: { "activityCenteranzhuo": "activityCenteranzhuo" },
                    value: 1
                }, function (ret, err) {
                    console.log(JSON.stringify(ret));
                });
            }
            var type = $(this).attr("data-url");
            var getTitle = $(this).attr("data-title");
            // console.log("-是否是网址" + app.regHttp(type) + "--" + !app.regHttp(type));
            if (type.split("-")[0] == "activity") {
                if (!app.isLogin()) {
                    // 跳转登录页面
                    app.toast("该操作需要登录");
                    setTimeout(function () {
                        app.goLogin();
                    }, 1000)
                    return;
                }
                var account = app.getAccount();
                app.openWin({
                    name: "browser_header_win",
                    url: app.hd + "common/headerwin.html",
                    pageParam: {
                        subpage: type.split("-")[1] + account.uid + "&pageName=indexPage",
                        name: "browser_header_win",
                        type: "remote",
                        title: getTitle
                    }
                });
                // var param = {
                //     name: "browser_header_win",
                //     url: type.split("-")[1] + account.uid + "&pageName=indexPage",
                //     title: getTitle
                // }
                // app.setNavBarAttrPrimary(param);
                return
            }
            if (type.split("-")[0] == "openIpfs" || type.split("-")[0] == "nationalDay") {
                var account = app.getAccount();
                if (!account || !account.ipfs_uuid) {
                    app.toast("该操作需要重新登录");
                    app.trigger("quit_login");
                    app.goLogin();
                }
                var openUrl = type.split("-")[1] + account.ipfs_uuid;
                if (type.split("-")[0] == "nationalDay") {
                    openUrl = type.split("-")[1] + account.uid;
                    app.openWin({
                        name: "browser_header_win",
                        url: app.hd + "common/headerwin.html",
                        pageParam: {
                            subpage: openUrl,
                            name: "browser_header_win",
                            type: "remote",
                            isremote: "true",
                            title: getTitle
                        }
                    });
                    return
                }
                var param = {
                    name: "browser_header_win",
                    url: openUrl,
                    title: getTitle
                }
                app.setNavBarAttrPrimary(param);
                return
            }
            if (!app.regHttp(type)) {
                if (!app.isLogin()) {
                    // 跳转登录页面
                    app.toast("该操作需要登录");
                    setTimeout(function () {
                        app.goLogin();
                    }, 1000)
                    return;
                }
                if (type && type == "yaoqinghaoyou") {
                    var pageValue = {
                        name: "yaoqinghaiyou",
                        subpage: "mine/yaoqinghaiyou",
                        title: "邀请好友赚奖励",
                        param: {
                            pageName: "yaoqinghaiyou"
                        }
                    }
                    app.setNavBarAttr(pageValue);
                }
                if (type && type == "suanlijingcai") {
                    app.checkStausOther(function (ret, err) {
                        dataCheck = {
                            statusCode: ret.code,
                            statusText: ret.message
                        };
                        if (dataCheck.statusCode == 609 || dataCheck.statusCode == 614) {
                            var param = {
                                dtype: "dialog251",
                                data: {
                                    text: "提示",
                                    tipsText: "您暂未实名，请去【安全设置-实名认证】进行实名。",
                                    btns: [{
                                        name: "取消",
                                        event: "canlefirstPageCheck"
                                    }, {
                                        name: "确认",
                                        event: "gofirstpageCheck"
                                    }]
                                }
                            };
                            app.dialog(param);
                        } else if (dataCheck.statusCode == 602) {
                            app.toast("亲,你的信息正在审核中……");
                        } else if (dataCheck.statusCode == 200) {
                            var getbhpStore = app.bhpayIsLine();
                            if (getbhpStore == "true") {
                                app.ajaxPro({
                                    url: "site/geturl",
                                    values: {},
                                    openFlower: true
                                }, function (ret) {
                                    var pageUrl = ret.data.url;
                                    var recodeList = ret.data.sljc_list_url;
                                    app.openWin({
                                        name: "suanlijingcai",
                                        url: app.hd + "common/headerwin.html",
                                        pageParam: {
                                            subpage: recodeList,
                                            name: "suanlijingcai",
                                            type: "remote",
                                            isremote: "true",
                                            title: "我的竞猜"
                                        }
                                    });
                                })
                                return false
                            }
                            app.getBhpayAbout(function (ret) {
                                if (ret.code != 200) {
                                    app.bhpayIsLine("false");
                                    var param = {
                                        dtype: "dialog46",
                                        data: {
                                            eventText: "firstConnectBhpay"
                                        }
                                    };
                                    app.dialog(param);
                                } else {
                                    app.bhpayIsLine("true");
                                    app.ajaxPro({
                                        url: "site/geturl",
                                        values: {},
                                        openFlower: true
                                    }, function (ret) {
                                        var pageUrl = ret.data.url;
                                        var recodeList = ret.data.sljc_list_url;
                                        app.openWin({
                                            name: "suanlijingcai",
                                            url: app.hd + "common/headerwin.html",
                                            pageParam: {
                                                subpage: recodeList,
                                                name: "suanlijingcai",
                                                type: "remote",
                                                isremote: "true",
                                                title: "我的竞猜"
                                            }
                                        });
                                    })
                                }
                            })
                        } else {
                            var param = {
                                dtype: "dialog251",
                                data: {
                                    text: "提示",
                                    tipsText: "您暂未实名，请去【安全设置-实名认证】进行实名。",
                                    btns: [{
                                        name: "取消",
                                        event: "canlefirstPageCheck"
                                    }, {
                                        name: "确认",
                                        event: "gofirstpageCheck"
                                    }]
                                }
                            };
                        }
                    })
                }
            } else {
                var goCerfition = {
                    name: "browser",
                    subpage: "common/browser",
                    title: getTitle.length > 10 ? (getTitle.substring(0, 10) + "…") : getTitle,
                    param: {
                        pageName: "browser",
                        url: type
                    }
                }
                app.setNavBarAttr(goCerfition);
            }
        })
        app.downRefresh(function () {
            $(".imgLi").empty();
            curpage = 1;
            totalPage = 1;
            getActivityImg(curpage, true);
        });
        // 监听滚动到底部 加载更多
        app.toBottom(function () {
            if (curpage < totalPage) {
                curpage++;
                getActivityImg(curpage, false);
            }
        })
        app.headerMap();
        app.listen('goIPFSnew', function () {
            app.closeW();
        })
    }

</script>
<script type="text/html" id="bannerImg">
    {{~it:it:index}}
        <li data-url="{{=it.url}}" data-title="{{=it.title}}">
            <img src="{{=it.pic_list}}" class="activiImg">
            {{?it.status==0 && it.hot==1}}
                <img src="../../image/hotasdx.png" class="stuasImg">
            {{??it.status==1}}
                <img src="../../image/jijiangkaishiasx.png" class="stuasImg">
            {{??it.status==2}}
                <img src="../../image/yijieshupjx.png" class="stuasImg">
            {{?}}
        </li>
    {{~}}
</script>

</html>